<?php

if($_POST)
{
    // 获取本地存储name 为 imgcode1 的value值 将值于 表单post 提交 value值进行比较
    $cookie = isset($_COOKIE["imgcode1"]) ? $_COOKIE["imgcode1"] :"";
    $imgcode1 = isset($_POST["imgcode1"]) ? $_POST["imgcode1"] :"";
    var_dump($imgcode1, $cookie);
    if(strtolower($cookie) == strtolower($imgcode1)){
        echo"验证成功!";
    }else{
        echo"失败!";  
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>demo1跳转页</title>
</head>
<body>
    <form method="post">
        <!-- 验证码图片 this就表示图片-->
        <img src="imgcode1.php" onclick="this.src=`imgcode1.php?mage=${Math.random(0,100)}`"><br />
        验证码:<input type="text" name = "imgcode1" />
        <button type="submit">提交</button>
    </form>
</body>
</html>